<link rel="stylesheet" href="/Public/css/common/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="/Public/css/common/base.css">
<link rel="stylesheet" type="text/css" href="/Public/css/common/animate.css">
<link rel="stylesheet/less" type="text/css" href="/Public/css/common/wangEditor.less">
<link rel="stylesheet" href="/Public/css/common/swiper.css">
<link rel="stylesheet/less" type="text/css" href="/Public/css/common/index.less">
<link rel="stylesheet/less" type="text/css" href="/Public/css/editor/editor_panel.less">
<style>
    .row{margin-left: 0px;margin-right: 0px}
    body{font-size: 14px}
    /*.swiper-container{height: 300px}*/
</style>
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header">
                <present name="editor">编辑<else/>添加</present>页面
            </h3>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <ul class="nav nav-tabs" id="myTab">
                        <li class="active"><a href="#basic">页面设置</a></li>
                        <li><a href="#push">推送设置</a></li>
                        <li><a href="#share">分享设置</a></li>
                    </ul>
                </div>
                <div class="panel-body">
                    <div class="form-horizontal">
                        <present name="editor.id">
                            <input type="hidden" name="id" value="{$editor['id']}">
                        <else />
                            <input type="hidden" name="id" value="-1">
                        </present>
                        <input type="hidden" name="version" value="{$version}">
                        <div class="tab-content">
                            <div class="tab-pane active" id="basic">
                                <include file="basic" />
                            </div>
                            <div class="tab-pane" id="push">
                                <include file="push" />
                            </div>
                            <div class="tab-pane" id="share">
                                <include file="share" />
                            </div>
                        </div>
                        <!--<button type="button" id="sub_button" class="btn btn-primary">提交</button>-->
                        <!--<button type="button" class="btn btn-default" onclick="history.go(-1)">返回列表</button>-->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/Public/js/common/jquery-ui.js"></script>
<script src="/Public/js/common/less.js"></script>
<script src="/Public/js/common/wangEditor.min.js"></script>
<script src="/Public/js/common/swiper.jquery.js"></script>

<script src="/Public/js/common/common.js"></script>
<script src="/Public/js/editor/editor.js?v0"></script>
<script type="text/javascript">
    $(function () {
        $('#myTab a:first').tab('show');//初始化显示哪个tab

        $('#myTab a').click(function (e) {
            e.preventDefault();//阻止a链接的跳转行为
            $(this).tab('show');//显示当前选中的链接及关联的content
        })
        //拖动
        $("#widgets").mouseover(function(){
            $("#move").css("display", "block");
        })
        var $div = $("#move");
        /* 绑定鼠标左键按住事件 */
        $div.bind("mousedown",function(event){
            /* 获取需要拖动节点的坐标 */
            var offset_x = $("#widgets")[0].offsetLeft;//x坐标
            var offset_y = $("#widgets")[0].offsetTop;//y坐标
            /* 获取当前鼠标的坐标 */
            var mouse_x = event.pageX;
            var mouse_y = event.pageY;
            /* 绑定拖动事件 */
            /* 由于拖动时，可能鼠标会移出元素，所以应该使用全局（document）元素 */
            $(document).bind("mousemove",function(ev){
                /* 计算鼠标移动了的位置 */
                var _x = ev.pageX - mouse_x;
                var _y = ev.pageY - mouse_y;
                /* 设置移动后的元素坐标 */
                var now_x = (offset_x + _x ) + "px";
                var now_y = (offset_y + _y ) + "px";
                var now_x1 = (offset_x + _x - 20 ) + "px";
                var now_y1 = (offset_y + _y) + "px";
                /* 改变目标元素的位置 */
                //$div.css({
                $("#widgets").css({
                    top:now_y,
                    left:now_x
                });
                $("#move").css({
                    top:now_y1,
                    left:now_x1
                });
            });
        });
        /* 当鼠标左键松开，接触事件绑定 */
        $(document).bind("mouseup",function(){
            $(this).unbind("mousemove");
        });
    })
</script>